package com.example.logindemo2.view

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.example.logindemo2.utils.AppManager

abstract class BaseActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(getLayoutId())
        AppManager.instance.addActivity(this)
        initView()
        initData()
    }

    override fun onDestroy() {
        super.onDestroy()
        AppManager.instance.removeActivity(this)
    }

    open fun initView() {}
    open fun initData() {}
    abstract fun getLayoutId(): Int
}